//
//  YSVideoCollectionEditCell.m
//  Yueshi
//
//  Created by yueshi－mac1 on 16/1/11.
//  Copyright © 2016年 悦食中国. All rights reserved.
//

#import "YSVideoCollectionEditCell.h"
#import "UIImageView+VideoImage.h"

@interface YSVideoCollectionEditCell()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@end

@implementation YSVideoCollectionEditCell

+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *CellIdentiferId = @"YSVideoCollectionEditCell";
    YSVideoCollectionEditCell *cell =  [tableView dequeueReusableCellWithIdentifier:CellIdentiferId];
    if(cell == nil){
        NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"YSVideoCollectionEditCell" owner:nil options:nil];
        cell = [nibs lastObject];
    }
    return cell;
}

-(void)setAdvert:(YSAdvert *)advert{
    _advert = advert;
    [self.nameLabel setText:advert.advertTitle];
    [self.statusBtn setSelected:advert.status];
    [self.iconView setImageWithVideoUrl:advert.advertVideoUrl];
}

- (IBAction)tapLeftStatus:(UIButton *)sender {
    [self.statusBtn setSelected:!self.statusBtn.selected];
    [_advert setStatus:self.statusBtn.selected];
    [[NSNotificationCenter defaultCenter]postNotificationName:kMarkVideoItemChangeNortif object:nil];
}
@end
